﻿
@{
    ViewData["Title"] = "Index";
    Layout = "~/Views/Share/_Layout.cshtml";
}
<link href="~/Lib/Mobile/jquery.mobile-1.4.5.min.css" rel="stylesheet" />
<script src="~/Lib/Mobile/jquery.mobile-1.4.5.min.js"></script>
<script type="text/javascript">
    $(function () {
        PTCreate();
        LogoCreate();
    });
    function PTCreate() {
        pt = escape($("#PT").val());//防止中文等特殊字符引起问题
        ptSize = $("#PTSize").val();
        var id = document.getElementById("PTImg");
        var str = "../QRCode/GetPTQRCode?url=" + pt + "&pixel=" + ptSize + "&random=" + Math.random();
        id.setAttribute("src", str);
    }
    function LogoCreate() {
        logo = escape($("#Logo").val());
        logoPath = escape($("#LogoPath").val());
        logoSize = $("#LogoSize").val();
        var id = document.getElementById("LogoImg");
        var str = "../QRCode/GetLogoQRCode?url=" + logo + "&logoPath=" + logoPath + "&pixel=" + logoSize + "&random=" + Math.random();
        id.setAttribute("src", str);
    }
</script>
<div style="width:60%; margin:auto;text-align:center;">
    <h2>普通二维码</h2>
    <input type="text" class="form-control" id="PT" placeholder="请输入字符" value="@Html.Raw(ViewBag.URL)"><button onclick="PTCreate();">生成</button>
    <input type="range" name="points" id="PTSize" value="5" min="1" max="20" onchange="PTCreate();">
    <br />
    <img id="PTImg" />
    <h2>带Logo二维码</h2>
    <input type="text" class="form-control" id="Logo" placeholder="请输入字符" value="@Html.Raw(ViewBag.URL)">
    <input type="text" class="form-control" id="LogoPath" placeholder="logo位置" value="/Img/logo.png">
    <button onclick="LogoCreate();">生成</button>
    <input type="range" name="points" id="LogoSize" value="5" min="1" max="20" onchange="LogoCreate();">
    <img id="LogoImg" />
</div>

